﻿@model Sundry.Model.PromptModel
@{
    ViewBag.Title = "操作提示";
}
@section Header{
    <link href="/Areas/Admin/Content/Site.css" rel="stylesheet" />
    @{
        if (Model.IsAutoBack)
        {
            if (Model.CountdownModel == 0)
            {
                <meta http-equiv="refresh" content="@Model.CountdownTime;URL=@Model.BackUrl" />
            }
            else
            {
                <script type="text/javascript">
                    window.onload = function(){
                        var time = @Model.CountdownTime; //设置时间为几秒
                        var timer = document.getElementById('timer'); //获取ID为timer的对象
                        timer.innerHTML = time; //初始化显示秒数
                        time = time - 1;
                        var g = window.setInterval(function(){
                            if(time<0){
                                window.clearTimeout(g); //清除动画
                                window.location.href = '@Model.BackUrl'; //跳转到指定地址
                                //window.history.back(-1); //后退
                            } else {
                                showTime();
                            }
                        },1000);
                        //显示函数
                        function showTime(){
                            timer.innerHTML = time;
                            time--;
                        }
                    };
                </script>
            }
        }
    }
}
<div class="main-content">
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try { ace.settings.check('breadcrumbs', 'fixed') } catch (e) { }
        </script>
        <ul class="breadcrumb">
            <li>
                <i class="ace-icon fa fa-home home-icon"></i>
                <a href="Admin/Home/index">控制台</a>
            </li>
            <li class="active">操作提示</li>
        </ul>
    </div>
    <div class="page-content">

        <div class="row">
            <div class="col-xs-12">
                <div class="tip">
                    <h3>@Html.Raw(Model.Message)</h3>
                    <p>
                        如果您不做出选择，将在
                        @{
                            if (Model.CountdownModel == 0)
                            {
                                @Model.CountdownTime
                            }
                            else
                            {
                                <span id="timer">@Model.CountdownTime</span>
                            }
                        }
                        秒后自动返回
                    </p>
                    @if (Model.IsShowBackLink)
                    {
                        <a href="@Model.BackUrl">←点击返回</a>
                    }
                </div>
            </div>
        </div>
    </div>
</div>
